<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改新生儿基本信息')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-baseinfo-edit" th:object="${tNewbornBaseinfo}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label">新生儿姓名：</label>
                <div class="col-sm-8">
                    <input name="newbornName" th:field="*{newbornName}" class="form-control" type="text" disabled>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">新生儿性别：</label>
                <div class="col-sm-8">
                    <select name="newbornSex" class="form-control m-b" disabled th:field="*{newbornSex}">
                        <option value="1">男</option>
                        <option value="2">女</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">所在医院名称：</label>
                <div class="col-sm-8">
                    <input name="hospitalName" th:field="*{hospitalName}" class="form-control" type="text" disabled>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">母亲姓名：</label>
                <div class="col-sm-8">
                    <input name="momName" th:field="*{momName}" class="form-control" type="text" disabled>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">出生日期：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="birthday" th:value="${#dates.format(tNewbornBaseinfo.birthday, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" disabled>
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">新生儿体重：</label>
                <div class="col-sm-8">
                    <input name="newbornweight" th:field="*{newbornweight}" class="form-control" type="text" disabled>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">家属联系方式：</label>
                <div class="col-sm-8">
                    <input name="phone" th:field="*{phone}" class="form-control" type="text" disabled>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">家属联系地址：</label>
                <div class="col-sm-8">
                    <input name="address" th:field="*{address}" class="form-control" type="text" disabled>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">母亲身份证：</label>
                <div class="col-sm-8">
                    <input name="momIdcard" th:field="*{momIdcard}" class="form-control" type="text" disabled>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">孕次产次：</label>
                <div class="col-sm-8">
                    <input name="pregnancyTimes" th:field="*{pregnancyTimes}" class="form-control" type="text" disabled>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">新生儿检查状态：</label>
                <div class="col-sm-8">
                    <select name="status" class="form-control m-b">
                        <option value="2" selected>待复检</option>
                        <option value="3">待治疗</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">初检结果：</label>
                <div class="col-sm-8">
                    <input name="firstInspectResult" th:field="*{firstInspectResult}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group" id="diseaseName">
                <label class="col-sm-3 control-label">疾病名称：</label>
                <div class="col-sm-8">
                    <input name="diseaseName" class="form-control" type="text" required>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "system/firstInspect";
        $("#form-baseinfo-edit").validate({
            focusCleanup: true
        });

        $(function() {
            $("#diseaseName").hide()
        });

        $("select[name='status']").change(function () {
            var status = $("select[name='status']").val()
            console.log('status is', status)
            if(status === '2'){
                console.log('隐藏')
                $("#diseaseName").hide()
            }else if(status === '3'){
                console.log('显示')
                $("#diseaseName").show()
            }
        })

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-baseinfo-edit').serialize());
            }
        }

        $("input[name='birthday']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>
